package br.com.fitness.core.domain.person;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;

import br.com.fitness.core.AbstractEntity;

@Entity(name = "tb_contact")
public class Contact implements AbstractEntity {

	private static final long serialVersionUID = 1L;
	
	@Id
	@SequenceGenerator(allocationSize = 1, initialValue = 1, name = "contact_seq", sequenceName = "contact_seq")
	@GeneratedValue(generator = "contact_seq", strategy = GenerationType.SEQUENCE)
	@Column(nullable = false)
	private Integer code;
	private String email;
	private String phone;
	private String cellphoneOne;
	private String cellphoneTwo;

	public Contact() {

	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getCellphoneOne() {
		return cellphoneOne;
	}

	public void setCellphoneOne(String cellphoneOne) {
		this.cellphoneOne = cellphoneOne;
	}

	public String getCellphoneTwo() {
		return cellphoneTwo;
	}

	public void setCellphoneTwo(String cellphoneTwo) {
		this.cellphoneTwo = cellphoneTwo;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((cellphoneOne == null) ? 0 : cellphoneOne.hashCode());
		result = prime * result
				+ ((cellphoneTwo == null) ? 0 : cellphoneTwo.hashCode());
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		result = prime * result + ((email == null) ? 0 : email.hashCode());
		result = prime * result + ((phone == null) ? 0 : phone.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Contact other = (Contact) obj;
		if (cellphoneOne == null) {
			if (other.cellphoneOne != null)
				return false;
		} else if (!cellphoneOne.equals(other.cellphoneOne))
			return false;
		if (cellphoneTwo == null) {
			if (other.cellphoneTwo != null)
				return false;
		} else if (!cellphoneTwo.equals(other.cellphoneTwo))
			return false;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		if (email == null) {
			if (other.email != null)
				return false;
		} else if (!email.equals(other.email))
			return false;
		if (phone == null) {
			if (other.phone != null)
				return false;
		} else if (!phone.equals(other.phone))
			return false;
		return true;
	}

}
